<!-- 查看壁纸详情弹窗 DemandLog -->
<template>
  <div>
    <el-dialog title="历史记录" :visible.sync="demandLogDialogShow" :before-close="handleClose" center width="920px">
      <el-table :data="list" border style="width: 920px">
      <el-table-column prop="operationTime" label="操作时间" width="180"></el-table-column>
      <el-table-column prop="operName" label="用户账号" width="120"></el-table-column>
      <el-table-column prop="operation" label="操作类型" width="120">
        <template v-slot="scope">
        <span v-if="scope.row.operation === '0'">删除</span>
        <span v-if="scope.row.operation === '1'">创建</span>
        <span v-if="scope.row.operation === '2'">编辑</span>
        </template>
      </el-table-column><el-table-column prop="operationDetail" label="操作详情" width="500"></el-table-column>
      </el-table>
      <div slot="footer" class="dialog-footer">
        <el-button @click="handleClose">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { post } from '@/api/my_axios'

export default {
  name: '',
  props: {
    // 是否是查看模式
    isViewMode: {
      type: Boolean,
      default: () => {
        return true
      }
    },
    // 其他需要的属性
    demandLogDialogShow: {
      type: Boolean,
      default: () => {
        return false
      }
    },
    id: {
      type: String,
      default: () => {
        return ''
      }
    }
  },
  data () {
    return {
      formLabelWidth: '120px',
      form: {},
      list: []
    }
  },
  watch: {
    demandLogDialogShow (vo) {
      if (vo) {
        this.getDemandLogData()
      }
    }
  },

  methods: {

    async getDemandLogData () {
      this.list = []
      this.demandLogDialogShow = true
      const item = await post('/api/crm/sys/manage/demand/queryOperLog', { demandId: this.id })
      this.list = item.data
    },

    handleClose () {
      this.list = []
      this.$emit('isDev', 'no')
    }
  }
}
</script>
<style lang="scss" scoped>
.el-select {
  width: 100%;
}
</style>
